import { N as request } from './index-Cc4oxzDN.js';
import { b as getPaymentFrom, d as debugPlatformInfo } from './platform.EIa5ETLd.js';

/**
 * 订单创建  
 */
function orderSubmit(data) {
	console.log('订单提交 - 原始数据:', data);

	// 自动添加平台标识
	const orderData = {
		...data,
		from: getPaymentFrom()
	};

	console.log('订单提交 - 添加平台标识后:', orderData);

	return request.post(`/order/create`, orderData, {
		login: false
	})
}


function orderPrintSubmit(data) {
	console.log('订单打印提交 - 原始数据:', data);

	// 自动添加平台标识
	const printData = {
		...data,
		from: getPaymentFrom()
	};

	console.log('订单打印提交 - 添加平台标识后:', printData);

	return request.post('/order/print', printData)
}


/**
 * 订单列表  
 */
function orderGetOrders(data) {
	return request.get(`/order/list`, data, {
		login: false
	})
}


/**
 * 计算详情 
 */
function orderDetail(data) {
	return request.get(`/order/detail/${data}`, data, {
		login: false
	})
}



/**
 * 订单收货 
 */
function orderReceive(data) {
	return request.post(`/order/take`, data, {
		login: false
	})
}

/**
 * 订单退款 
 */
function orderRefund(data) {
	return request.post(`/order/refund`, data, {
		login: false
	})
}


/**
 * 订单支付 
 */
function payUnify(data) {
	console.log('支付统一接口 - 原始数据:', data);

	// 输出平台调试信息
	debugPlatformInfo();

	// 自动添加平台标识（如果没有手动指定from参数）
	const paymentData = {
		...data,
		from: data.from || getPaymentFrom()  // 优先使用手动指定的from，否则自动识别
	};

	console.log('支付统一接口 - 添加平台标识后:', paymentData);

	return request.post(`/order/pay`, paymentData, {
		login: false
	})
}



function createScanPaymentOrder(data) {
	console.log('扫码支付订单 - 原始数据:', data);

	// 自动添加平台标识
	const scanPayData = {
		...data,
		from: data.from || getPaymentFrom()
	};

	console.log('扫码支付订单 - 添加平台标识后:', scanPayData);

	return request.post('/order/scan-payment/create', scanPayData)
}

export { orderReceive as a, orderSubmit as b, createScanPaymentOrder as c, orderDetail as d, orderRefund as e, orderPrintSubmit as f, orderGetOrders as o, payUnify as p };
